package com.example.server.Contr;

import com.example.server.Service.DatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@RestController
@CrossOrigin
@RequestMapping("/database")
public class DatabaseContr {
    @Autowired
    private DatabaseService databaseService;
    @RequestMapping("/sex")
    public Map<String,Integer> selectsex(){
        return databaseService.selectsex();
    }
    @RequestMapping("/type")
    public Map<String,Integer> selecttype(){
        return databaseService.selecttype();
    }
    @RequestMapping("/register")
    public int[] selectregister(@RequestParam("year") int year){
        return databaseService.selectregister(year);
    }
    @RequestMapping("/province")
    public List<Map<String,Object>> selectprovince(){
        return databaseService.selectprovince();
    }
    @RequestMapping("/provinceall")
    public Map<String,Object> selectprovinceall(){
        return databaseService.selectprovinceall();
    }
    @RequestMapping("/far")
    public Map<String,Object> selectfar(){
        return databaseService.selectfar();
    }
    @RequestMapping("/review")
    public Map<String,List> selectreview(){
        return databaseService.selectreview();
    }
}
